//
//  KFDCurrentPriceBoard.m
//  KFD
//
//  Created by JIRENTIANXIANG on 7/3/15.
//  Copyright © 2015 kfd. All rights reserved.
//

#import "KFDCurrentPriceBoard.h"
#import "ui_config.h"
#import "KFDDetailedMarketPrice.h"

@interface KFDCurrentPriceBoard ()

@property (weak, nonatomic) IBOutlet UILabel *priceLabel;
@property (weak, nonatomic) IBOutlet UILabel *growthLabel;
@property (weak, nonatomic) IBOutlet UILabel *growthRateLabel;

@end

@implementation KFDCurrentPriceBoard

-(void)setPrice:(KFDDetailedMarketPrice *)price
{
    _price=price;
    
    if (price.change_pro<0) {
        self.priceLabel.textColor=KFD_DOWN_COLOR;
        self.growthLabel.textColor=KFD_DOWN_COLOR;
        self.growthRateLabel.textColor=KFD_DOWN_COLOR;
    }else{
        self.priceLabel.textColor=KFD_UP_COLOR;
        self.growthLabel.textColor=KFD_UP_COLOR;
        self.growthRateLabel.textColor=KFD_UP_COLOR;
    }
    
    self.priceLabel.text=[NSString stringWithFormat:@"%.2f",price.price.floatValue];
    self.growthLabel.text=[NSString stringWithFormat:@"%.1f",price.price.doubleValue*price.change_pro.doubleValue/100.0];
    self.growthRateLabel.text=[NSString stringWithFormat:@"%.2f%@",price.change_pro.floatValue,@"%"];
}

@end
